package com.chushouya.controller.common;

import com.chushouya.common.annotations.AuthSkip;
import com.chushouya.common.constant.ServiceType;
import com.chushouya.manager.dto.admin.region.RegionTreeDTO;
import com.chushouya.manager.service.common.RegionService;
import com.general.framework.core.schema.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = ServiceType.COMMON + "区域树")
@RestController
@RequestMapping(ServiceType.COMMON + "/region")
public class RegionController {

    @Resource
    private RegionService regionService;

    @ApiOperation("省市区树")
    @GetMapping("/tree")
    @AuthSkip
    public Response<List<RegionTreeDTO>> tree() {
        return Response.success(regionService.regionTree());
    }
}
